﻿@model IEnumerable<IEstate.Core.Models.Estate>

@{
    ViewBag.Title = "Search";
}

<link rel="stylesheet" type="text/css" href="~/Content/Site.css" />
<link rel="stylesheet" type="text/css" href="~/Content/Style.css" />

<div style="font-family: Cambria; font-size: 25px; font-weight: 300">Search</div>

    @using (Html.BeginForm("xSearch", "Home", FormMethod.Get, new { id = "form1", code = IEstate.Core.Models.Code.yes }))
    {
        @Html.ValidationSummary(true)
        <div class="data">
            @Html.Label("Min price")
            @Html.TextBox("minPrice", null, new { @class = "textbox-street" })
        </div>
        <div class="data">
            @Html.Label("Max price")
            @Html.TextBox("maxPrice", null, new { @class = "textbox-street" })
        </div>
        <div class="data">
            @Html.Label("Bedrooms")
            @Html.TextBox("bedrooms", null, new { @class = "textbox-street" })
        </div>
        <div class="data">
            @Html.Label("Category")
            @Html.DropDownList("Category", new SelectList(Enum.GetNames(typeof(IEstate.Core.Models.Category))))
        </div>
        <div class="data">
            @Html.Label("Option")
            @Html.DropDownList("Option", new SelectList(Enum.GetNames(typeof(IEstate.Core.Models.Option))))
        </div>
        <input type="submit" value="Submit" />
    }

    <br />

    @if (ViewBag.Code == true)
    {
        <table class="bordered">
            <thead>
                <tr>
                    <th>#</th>
                    <th>Street</th>
                    <th>Bedroms</th>
                    <th>Size</th>
                    <th>Price</th>
                    <th>UID</th>
                </tr>
            </thead>
            @foreach (var i in Model)
            {
                <tr>
                    <td>@i.EstateID</td>
                    <td>@i.Street</td>
                    <td>@i.Bedrooms</td>
                    <td>@i.Size</td>
                    <td>@i.Price</td>
                    <td>@i.UID</td>
                </tr>
            }
        </table>
    }
